<%@ page language="java" contentType="image/jpeg; charset=UTF-8"
	import="java.awt.*" import="java.awt.image.BufferedImage"
	import="java.util.*" import="javax.imageio.ImageIO"%>
<%
response.setHeader("Pragma", "No-cache");
response.setHeader("Cache-Control", "No-cache");
response.setDateHeader("Expires", 0);
//create image in RAM!
int width=60,height=20;
BufferedImage image=new BufferedImage(width,height,BufferedImage.TYPE_INT_RGB);
//get graphics
Graphics g=image.getGraphics();
g.setColor(new Color(200,200,200));
g.fillRect(0, 0, width, height);
//create randrom (4 namber)
Random rnd = new Random();
int randNum=rnd.nextInt(8999)+1000;
String randStr=String.valueOf(randNum);
//save in session
session.setAttribute("randStr", randStr);
//display to image
g.setColor(Color.black);
g.setFont(new Font("",Font.PLAIN,20));
g.drawString(randStr, 10, 17);
//100-other
//
    
//output image to page
g.dispose();
ImageIO.write(image, "JPEG", response.getOutputStream());
out.clear();
out=pageContext.popBody();
%>






